var max = setTimeout(";");
for (var i=1; i< max; i++) clearTimeout(i);
I'm found the code in stack overflow can to clear all setTimeout events,
but how to understand var max = setTimeout(";");?
What mean is it?
Here is original question => How to stop all timeouts and intervals using javascript?
Thank you!
setTimeout returns a numeric ID which can be used to clear the timeout.
Creating a new timeout creates a new ID.
This code assumes that IDs will always be issued in sequential order (although I'm not aware of any implementation which doesn't).
It simply creates empty timeout. And since setTimeout returns it's reference as incremented value, that way you can tell how much timeouts there is on page